import { FC ,useState,useEffect} from "react"
import AUpload from "../../compent/AUpload";
import { AformConfig } from "./config/index"
import AForm from "../../compent/AForm";
import { comment } from "../../untils/api"
const Poster: FC = () => {
    const [pageSizes, setPageSize] = useState(10)
    const [page, setPage] = useState(1)
    const [total, settotal] = useState(0)
    const [data, setData] = useState([])
    const [fromobj, setFeomObj] = useState<object>({})
    useEffect(() => {
        getList(page)
    }, [])
   
    const getList = (page: number, pageSize: number = pageSizes, Fromobj: object = fromobj) => {
        const params = {
            page,
            pageSize: pageSize,
            ...Fromobj
        }
        console.log(params)
        comment.getComment(params).then(res => {
            console.log(res.data)
            console.log(res.data.data[1])
            //列表
            setData(res.data.data[0])
            //总数据
            settotal(res.data.data[1])
        })
    }
    const submit = (data: any) => {
        console.log(data)
    }
    return (
        <div>
            <AUpload></AUpload>
            <AForm onsubmit={submit} AformConfig={AformConfig}></AForm>
        </div>
    )
}

export default Poster